package com.my.cd.compose;

import java.util.function.Predicate;

/**
 * 主测试类
 */
public class MainTest {
    public static void main(String[] args) {
        Waitress waitress = new Waitress();
        CakeHouseMenu cakeHouseMenu = new CakeHouseMenu();
        DinerMenu dinerMenu = new DinerMenu();
        waitress.addComponent(cakeHouseMenu);
        waitress.addComponent(dinerMenu);

        System.out.println("展示所有菜单：");
        waitress.printMenu();

        System.out.println("\n展示素食或Cookie菜单：");
        Predicate<MenuComponent> p1 = MenuComponent::isVegetable;
        Predicate<MenuComponent> p2 = item -> item.getName().contains("Cookie");
        waitress.printMenu(p1.or(p2));
    }
}
